Axiell generic Media Server plugin

This generic Media Server plugin is capable of POSTing a binary stream or passing through requests to different external media storage/retrieval services, the latter using the mapping of the arguments passed to the getcontent command to a service URL. Assumptions for this to function:

  • The external service URL supports the HEAD request which is used to determine the content type of the requested media.
  • The requested media is returned by the external service as a byte stream.

Configuration of this new plugin is done like this:

<imageServerConfiguration name="generic">
    <servertype>FileSystem</servertype>
    <path>C:\Data\Projects\model5.0\images</path>
    <ImagePlugin type="Axiell.GenericService.Plugin.GenericPlugin, Axiell.GenericService.Plugin">
      <ServiceUrl>http://localhost/ImageServer/wwwopac.ashx?command=getcontent&server=generic&value=%value%</ServiceUrl>
      <AccessToken>9A722EF89-50A5-4045-B1115-A99B130D6092</AccessToken>
    </ImagePlugin>
  </imageServerConfiguration>

The ServiceUrl element holds the external service URL with the place holder elements between % characters. In the example above, the %value% place holder means that the incoming WebAPI getcontentrequest has a value= argument, and the value of that argument is placed in the ServiceUrl. All arguments passed in are accessible and can be used to form the new value of the ServiceUrl to be called, so from the following getcontent call:

https://server1.ourdomain.com/Azure/wwwopac.ashx?command=getcontent&server=azure&value=IMG_6936.JPG&height=200&width=200

the following placeholders can be used (also listed are the values referenced by the placeholders)

Placeholder - Value

%command% - getcontent

%server% - azure

%value% - IMG_6936.JPG

%height% - 200

%width% - 200

Any custom argument you add to the getcontent call can also be used. So something like:

https://server1.ourdomain.com/Azure/wwwopac.ashx?command=getcontent&server=azure&value=IMG_6936.JPG&source=Axiell

gives you the option to use a %source% placeholder in your ServiceUrl which will then be replaced with the value Axiell before calling the URL.

If an access token for the external service is needed you can specify that in the AccessToken node in the plugin configuration section and that will then be used as a Bearer token on the request to the external service.

Support for the HEAD request for the Axiell WebAPI has been added too. You can do a HEAD request with the getcontent call which will only return the header info with the content type and not the image itself: the body will be empty. With a normal GET request you will also get the media itself.

WriteContent / POST binary support

Besides the GetContent functionality, the Axiell generic Media Server plugin also supports the writing of content through the POST of a binary stream, to be able to fully use this plugin for all types of DAMS (possibly requiring authentication through a token).

For this you can use the <WriteContentUrl> property in the <ImagePlugin> configuration section for this plugin. For example:

<imageServerConfiguration name="generic">
<servertype>FileSystem</servertype>
<path>C:\Projects\test\media</path>
<ImagePlugin type="Axiell.GenericService.Plugin.GenericPlugin, Axiell.GenericService.Plugin">
<ServiceUrl>https://server.ourdomain.com/WebAPI/Imagehandling/wwwopac.ashx?command=getcontent&amp;server=images&amp;value=%value%</ServiceUrl>
<WriteContentUrl>https://server.ourdomain.com/WebAPI/Imagehandling/wwwopac.ashx?command=writecontent&amp;server=images&amp;value=%value%</WriteContentUrl>
<AccessToken>8b89didkfab-e166-2aa5-f3e5-b5doo49b902</AccessToken>
</ImagePlugin>
</imageServerConfiguration>

The e <WriteContentUrl> property is used for forwarding the uploaded content using the api's access token.

Support for default values

The generic Media Server plugin offers support for default values. This comes in handy if sometimes a different value for a call parameter needs to be provided while most often a default value should be used if that different value is not available. A use case would be when you would gradually like to move your system from local storage of media files to a DAMS. The local storage would then be the default server while only if a certain value in a particular record field is present, the DAMS would have to be the server.

For this, an (optional) list of default parameters can now be specified underneath the <ImagePlugin> node. A default parameter and its value will be applied to the configured URL when either the parameter is missing from the configured URL of when the parameter is empty in the configured URL.

Below you can see an example configuration in which the server parameter in the configured ServiceUrl has custom placeholder called %altserver%. When the caller replaces it with an actual image server name in the query, then that image server will be used: if not, then the server=images argument will be applied and the images image server will be used:

<imageServerConfiguration name="generic">
    <servertype>FileSystem</servertype>
    <path>C:\Data\Projects\model5.0\images</path>
    <ImagePlugin type="Axiell.GenericService.Plugin.GenericPlugin, Axiell.GenericService.Plugin">
      <ServiceUrl>http://localhost/ImageServer/wwwopac.ashx?command=getcontent&server=%altserver%&value=%value%</ServiceUrl>
      <DefaultParameters>
         <DefaultParameter key="server" value="images" />
      </DefaultParameters>
      <AccessToken>9A722EF89-50A5-4045-B1115-A99B130D6092</AccessToken>
    </ImagePlugin>
  </imageServerConfiguration>

An example of a getcontent call using an image server called myaltserver would be the following:

https://server1.ourdomain.com/wwwopac.ashx?command=getcontent&server=generic&altserver=myaltserver&value=IMG_6936.JPG&height=200&width=200

URL redirection support

Redirection support is present for faster response. When using the generic plugin, without authentication on the web service that is configured (! - authentication is required only to query the WebAPI and to retrieve the preview/proxy url’s: the retrieved temporary or static URL can play in any browser but always use the authenticated call to get the proper URL), redirection is applied. This means that when you call the WebAPI, the response URL in the browser is the direct endpoint that was configured. This leads to performance improvements, also for Collections, because when Collections calls the WebAPI, Collections will receive the response URL directly and the WebAPI will not first load the media and then pass it through to collections.
This redirect URL mechanism works with or without the fallback=true parameter.
The request URL configured for the WebAPI does need to start with https and because the WebAPI redirects the URL to Collections, the external service URL needs to be whitelisted in the Collections CSP <WhitelistImages> section like this for a K-Int service for example:
<WhitelistImages>https://rct-public.ciim.k-int.com/axiell/%value%</WhitelistImages>